;;; svelte-lsp-mode.el starts here

(setq lsp-keymap-prefix "C-c l")
(require 'company)
(require 'flycheck)
(require 'lsp-modeline)
(require 'lsp-headerline)
(require 'lsp-completion)
(require 'lsp-svelte)
(require 'lsp-lens)
(require 'lsp-ui)
(require 'which-key)
(require 'web-mode)


;;;###autoload
(define-derived-mode svelte-mode web-mode "svelte-mode"
  "A major mode deriving from web-mode to work with svelte files using lsp-mode"
  :group 'svelte
  (message "%s" "Activating svelte-mode...")
  (lsp-ensure-server 'svelte-ls)
  (lsp-ensure-server 'ts-ls)
  (which-key-mode)
  (lsp-enable-which-key-integration t)
  (if (not (assoc "svelte" web-mode-engines-alist))
      (cons '("svelte" . "\\.svelte\\'") web-mode-engines-alist))
  (flycheck-mode +1)
  (lsp)
  (lsp-ui-sideline-mode)
  (setq lsp-ui-sideline-show-hover t))

;;;###autoload
(add-to-list 'auto-mode-alist '("\\.svelte\\'" . svelte-mode))
(provide 'svelte-lsp-mode)

;;; svelte-lsp-mode.el ends here

